<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>最大升序子数组和</title>
</head>
<body>
  <script>
    function fn(nums) {
      let res = 0;
      let l = 0;
      while (l < nums.length) {
        let cursum = nums[l++]
        while (l < nums.length && nums[l] > nums[l - 1]) {
          cursum += nums[l++]
        }
        res = Math.max(res, cursum)
      }
      return res
    }
    console.log(fn([10, 20, 30, 5, 10, 50]))
  </script>
</body>
</html>